<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>C++11 Examples</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../index.html" title="Asio">
<link rel="up" href="../examples.html" title="Examples">
<link rel="prev" href="cpp03_examples.html" title="C++03 Examples">
<link rel="next" href="../reference.html" title="Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="cpp03_examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="asio.examples.cpp11_examples"></a><a class="link" href="cpp11_examples.html" title="C++11 Examples">C++11 Examples</a>
</h3></div></div></div>
<h5>
<a name="asio.examples.cpp11_examples.h0"></a>
        <span><a name="asio.examples.cpp11_examples.allocation"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.allocation">Allocation</a>
      </h5>
<p>
        This example shows how to customise the allocation of memory associated with
        asynchronous operations.
      </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
            <a href="../../../src/examples/cpp11/allocation/server.cpp" target="_top">../src/examples/cpp11/allocation/server.cpp</a>
            (<a href="../../examples/diffs/allocation/server.cpp.html" target="_top">diff to C++03</a>)
          </li></ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h1"></a>
        <span><a name="asio.examples.cpp11_examples.buffers"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.buffers">Buffers</a>
      </h5>
<p>
        This example demonstrates how to create reference counted buffers that can
        be used with socket read and write operations.
      </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
            <a href="../../../src/examples/cpp11/buffers/reference_counted.cpp" target="_top">../src/examples/cpp11/buffers/reference_counted.cpp</a>
            (<a href="../../examples/diffs/buffers/reference_counted.cpp.html" target="_top">diff
            to C++03</a>)
          </li></ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h2"></a>
        <span><a name="asio.examples.cpp11_examples.chat"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.chat">Chat</a>
      </h5>
<p>
        This example implements a chat server and client. The programs use a custom
        protocol with a fixed length message header and variable length message body.
      </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
            <a href="../../../src/examples/cpp11/chat/chat_message.hpp" target="_top">../src/examples/cpp11/chat/chat_message.hpp</a>
            (<a href="../../examples/diffs/chat/chat_message.hpp.html" target="_top">diff to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/chat/chat_client.cpp" target="_top">../src/examples/cpp11/chat/chat_client.cpp</a>
            (<a href="../../examples/diffs/chat/chat_client.cpp.html" target="_top">diff to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/chat/chat_server.cpp" target="_top">../src/examples/cpp11/chat/chat_server.cpp</a>
            (<a href="../../examples/diffs/chat/chat_server.cpp.html" target="_top">diff to C++03</a>)
          </li>
</ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h3"></a>
        <span><a name="asio.examples.cpp11_examples.echo"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.echo">Echo</a>
      </h5>
<p>
        A collection of simple clients and servers, showing the use of both synchronous
        and asynchronous operations.
      </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
            <a href="../../../src/examples/cpp11/echo/async_tcp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/async_tcp_echo_server.cpp</a>
            (<a href="../../examples/diffs/echo/async_tcp_echo_server.cpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/echo/async_udp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/async_udp_echo_server.cpp</a>
            (<a href="../../examples/diffs/echo/async_udp_echo_server.cpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/echo/blocking_tcp_echo_client.cpp" target="_top">../src/examples/cpp11/echo/blocking_tcp_echo_client.cpp</a>
            (<a href="../../examples/diffs/echo/blocking_tcp_echo_client.cpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/echo/blocking_tcp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/blocking_tcp_echo_server.cpp</a>
            (<a href="../../examples/diffs/echo/blocking_tcp_echo_server.cpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/echo/blocking_udp_echo_client.cpp" target="_top">../src/examples/cpp11/echo/blocking_udp_echo_client.cpp</a>
            (<a href="../../examples/diffs/echo/blocking_udp_echo_client.cpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/echo/blocking_udp_echo_server.cpp" target="_top">../src/examples/cpp11/echo/blocking_udp_echo_server.cpp</a>
            (<a href="../../examples/diffs/echo/blocking_udp_echo_server.cpp.html" target="_top">diff
            to C++03</a>)
          </li>
</ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h4"></a>
        <span><a name="asio.examples.cpp11_examples.futures"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.futures">Futures</a>
      </h5>
<p>
        This example demonstrates how to use std::future in conjunction with Asio's
        asynchronous operations.
      </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
            <a href="../../../src/examples/cpp11/futures/daytime_client.cpp" target="_top">../src/examples/cpp11/futures/daytime_client.cpp</a>
          </li></ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h5"></a>
        <span><a name="asio.examples.cpp11_examples.http_server"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.http_server">HTTP
        Server</a>
      </h5>
<p>
        This example illustrates the use of asio in a simple single-threaded server
        implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown
        by cancelling all outstanding asynchronous operations.
      </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/connection.cpp" target="_top">../src/examples/cpp11/http/server/connection.cpp</a>
            (<a href="../../examples/diffs/http/server/connection.cpp.html" target="_top">diff to
            C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/connection.hpp" target="_top">../src/examples/cpp11/http/server/connection.hpp</a>
            (<a href="../../examples/diffs/http/server/connection.hpp.html" target="_top">diff to
            C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/connection_manager.cpp" target="_top">../src/examples/cpp11/http/server/connection_manager.cpp</a>
            (<a href="../../examples/diffs/http/server/connection_manager.cpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/connection_manager.hpp" target="_top">../src/examples/cpp11/http/server/connection_manager.hpp</a>
            (<a href="../../examples/diffs/http/server/connection_manager.hpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/header.hpp" target="_top">../src/examples/cpp11/http/server/header.hpp</a>
            (<a href="../../examples/diffs/http/server/header.hpp.html" target="_top">diff to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/main.cpp" target="_top">../src/examples/cpp11/http/server/main.cpp</a>
            (<a href="../../examples/diffs/http/server/main.cpp.html" target="_top">diff to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/mime_types.cpp" target="_top">../src/examples/cpp11/http/server/mime_types.cpp</a>
            (<a href="../../examples/diffs/http/server/mime_types.cpp.html" target="_top">diff to
            C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/mime_types.hpp" target="_top">../src/examples/cpp11/http/server/mime_types.hpp</a>
            (<a href="../../examples/diffs/http/server/mime_types.hpp.html" target="_top">diff to
            C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/reply.cpp" target="_top">../src/examples/cpp11/http/server/reply.cpp</a>
            (<a href="../../examples/diffs/http/server/reply.cpp.html" target="_top">diff to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/reply.hpp" target="_top">../src/examples/cpp11/http/server/reply.hpp</a>
            (<a href="../../examples/diffs/http/server/reply.hpp.html" target="_top">diff to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/request.hpp" target="_top">../src/examples/cpp11/http/server/request.hpp</a>
            (<a href="../../examples/diffs/http/server/request.hpp.html" target="_top">diff to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/request_handler.cpp" target="_top">../src/examples/cpp11/http/server/request_handler.cpp</a>
            (<a href="../../examples/diffs/http/server/request_handler.cpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/request_handler.hpp" target="_top">../src/examples/cpp11/http/server/request_handler.hpp</a>
            (<a href="../../examples/diffs/http/server/request_handler.hpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/request_parser.cpp" target="_top">../src/examples/cpp11/http/server/request_parser.cpp</a>
            (<a href="../../examples/diffs/http/server/request_parser.cpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/request_parser.hpp" target="_top">../src/examples/cpp11/http/server/request_parser.hpp</a>
            (<a href="../../examples/diffs/http/server/request_parser.hpp.html" target="_top">diff
            to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/server.cpp" target="_top">../src/examples/cpp11/http/server/server.cpp</a>
            (<a href="../../examples/diffs/http/server/server.cpp.html" target="_top">diff to C++03</a>)
          </li>
<li class="listitem">
            <a href="../../../src/examples/cpp11/http/server/server.hpp" target="_top">../src/examples/cpp11/http/server/server.hpp</a>
            (<a href="../../examples/diffs/http/server/server.hpp.html" target="_top">diff to C++03</a>)
          </li>
</ul></div>
<h5>
<a name="asio.examples.cpp11_examples.h6"></a>
        <span><a name="asio.examples.cpp11_examples.spawn"></a></span><a class="link" href="cpp11_examples.html#asio.examples.cpp11_examples.spawn">Spawn</a>
      </h5>
<p>
        Example of using the asio::spawn() function, a wrapper around the <a href="http://www.boost.org/doc/libs/release/libs/coroutine/index.html" target="_top">Boost.Coroutine</a>
        library, to implement a chain of asynchronous operations using stackful coroutines.
      </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
            <a href="../../../src/examples/cpp11/spawn/echo_server.cpp" target="_top">../src/examples/cpp11/spawn/echo_server.cpp</a>
            (<a href="../../examples/diffs/spawn/echo_server.cpp.html" target="_top">diff to C++03</a>)
          </li></ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003-2015 Christopher M.
      Kohlhoff<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="cpp03_examples.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../next.png" alt="Next"></a>
</div>
</body>
</html>
